package com.wanmait.schedule.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 企业用户表
 * </p>
 *
 * @author wanmait
 * @since 2022-03-02
 */
@Data
@Accessors(chain = true)
@TableName("company_user")
public class CompanyUser {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 企业id
     */
    private Integer companyId;

    @TableField(exist = false)
    private Company company;
    /**
     * 部门id
     */
    private Integer departmentId;
    @TableField(exist = false)
    private Department department;
    /**
     * 用户id
     */
    private Integer userinfoId;

    @TableField(exist = false)
    private Userinfo userinfo;
    /**
     * 职位
     */
    private Integer positionId;
    @TableField(exist = false)
    private Position position;

    /**
     * 入职时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Field(name = "sub_time",type = FieldType.Date,format = DateFormat.date_optional_time)
    private Timestamp jobIn;

    /**
     * 离职时间（默认为null）
     */
    private LocalDateTime jobOut;

    /**
     *是否在职（0为在职，1为离职，默认为0）
     */
    @TableField
    private Boolean flag;

    /**
     * 存储任务列表
     * */
    @TableField(exist = false)
    private List<Task> taskList;

    /**
    *  用户真是姓名
    * */
    @TableField(exist = false)
    private String username;

}
